package com.itheima.controller;


import com.aliyun.utils.AliOssUtil;
import com.itheima.common.R;
import com.itheima.service.FileUploadLogService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * <p>
 * 文件上传日志表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-07-28
 */
@RestController
@RequestMapping("/upload")
public class FileUploadLogController {
    @Autowired
    private FileUploadLogService fileUploadLogService;
@PostMapping
    public R upload( MultipartFile file) throws IOException {
    String url = new AliOssUtil().upload(file.getInputStream());
    System.out.println("=========================================" + url);
    return R.ok(url);
    }
}
